﻿<# requires -version 2
.SYNOPSIS
Collect complete backup chain
.DESCRIPTION
Collect complete backup chain from FULL over DIFF to last LOG backup.
The chain is on all direct available files
.NOTES
Filename   : SqlAdminBackupChain.ps1
Author     : Niels Grove-Rasmussen
.LINK
.SYNTAX
	.\SqlAdminBackupChain.ps1 -ComputerName <Computername> -DbInstanceName <Database instance name>
.EXAMPLE
	.\SqlAdminBackupChain.ps1
#>

Set-StrictMode -Version 2.0

Import-Module 'SQLPS' -DisableNameChecking

$DebugPreference = "Continue"

# Basic parameters. Could be moved to config-file
[String]$ServerName = '(local)'
[String]$SqlBackupFolder = 'D:\SqlBackup'

[String]$DbName = 'dummy'

# Last Full backup
$BackupFile = Get-ChildItem "$SqlBackupFolder" -Filter '*.bak' |
	Sort-Object LastWriteTime |
	Select-Object -Last 1
Write-Debug "$($BackupFile.FullName)"

# Last Differential backup

# 
